package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Teacher;
import com.itheima.edu.info.manager.util.AgeUtil;

import java.util.Scanner;

public class TeacherController extends BaseTeacherController {

    //创建键盘录入
    Scanner sc = new Scanner(System.in);

    //输入老师信息并封装为老师对象的优化方法
    public Teacher inputTeacherinfo(String id) {
        System.out.println("请输入老师的姓名：");
        String name = sc.next();

        System.out.println("请输入老师的出生日期：");
        String birthday = sc.next();

        //调用年龄工具类方法，根据出生日期计算年龄
        String age= AgeUtil.getAge(birthday);

        //将录入的数据封装为老师对象
        Teacher tea = new Teacher(id,name,age,birthday);
        return tea;
    }

}
